package com.example.xd.mvp_project.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.xd.mvp_project.R;
import com.example.xd.mvp_project.model.bean.FancBean;

import java.util.List;

/**
 * @auther XuDan on 2018/10/22.
 */
public class FancListAdapter extends BaseQuickAdapter<FancBean, BaseViewHolder> {
    List<FancBean> data;

    public FancListAdapter(int layoutResId, @Nullable List<FancBean> data) {
        super(layoutResId, data);
        this.data = data;
    }

    @Override
    protected void convert(BaseViewHolder helper, FancBean item) {
        helper.setText(R.id.fanc_recycle_item_tv, item.getName());
    }

    public int getLetterPosition(String header) {
        for (int i = 0; i < data.size(); i++) {
            if (data.get(i).getHeaderWord().equals(header)) {
                return i;
            }

        }
        return -1;

    }
}
